package com.hanbang.maige.mode.javabean.huodong;

import android.os.SystemClock;

import com.google.gson.annotations.Expose;
import com.hanbang.maige.mode.enumeration.HuoDongStatus;
import com.hanbang.maige.utils.other.DateUtils;
import com.hanbang.maige.utils.other.StringUtils;

import java.util.List;

/**
 * Created by Administrator on 2016/10/28.
 */

public class HuoDongDetailData {


    /**
     * ActivityID : 13f24390-a4a3-4a0c-a155-06ed4a829692
     * ActivityName : 惊喜不断
     * ActivityAddress : 苏州坚持十万大山
     * StartTime : /Date(1477711980000)/
     * EndTime : /Date(1480303980000)/
     * ActiveHaiBao : /upload/201610/28/big/huodong/201610281135225553.jpg
     * ActiveHaiBaoMid : /upload/201610/28/middle/huodong/201610281135225553_Mid.jpg
     * ActiveHaiBaoSma : /upload/201610/28/small/huodong/201610281135225553_Sma.jpg
     * ActiveJieShao : 大家伙都??…………………………………………………………………………………………………………………………………………
     * Zhuangtai : 1
     * CanyuPeoples : []
     */
    @Expose(deserialize = false)
    private long elapsedRealtime;
    @Expose(deserialize = false)
    private long differenceTime;

    private long Activedjs;
    private String ActivityName;
    private String ActivityAddress;
    private String StartTime;
    private String EndTime;
    private String ActiveHaiBaoMid;
    private String ActiveJieShao;
    private List<BaomingPeoplesData> CanyuPeoples;
    /**
     * NiChenName : mg162747
     * CanyuPeopleCount : 0
     */

    private String NiChenName;
    private int CanyuPeopleCount;

    public HuoDongDetailData() {
        elapsedRealtime = SystemClock.elapsedRealtime();
    }


    public String getActivityName() {
        return StringUtils.dataFilter(ActivityName, "");
    }

    public void setActivityName(String ActivityName) {
        this.ActivityName = ActivityName;
    }

    public String getActivityAddress() {
        return StringUtils.dataFilter(ActivityAddress);
    }

    public void setActivityAddress(String ActivityAddress) {
        this.ActivityAddress = ActivityAddress;
    }

    public String getStartTime() {
        return StartTime;
    }


    public void setStartTime(String StartTime) {
        this.StartTime = StartTime;
    }

    public String getEndTime() {
        return EndTime;
    }

    public void setEndTime(String EndTime) {
        this.EndTime = EndTime;
    }

    public String getActiveHaiBaoMid() {
        return StringUtils.dataFilter(ActiveHaiBaoMid);
    }

    public void setActiveHaiBaoMid(String ActiveHaiBaoMid) {
        this.ActiveHaiBaoMid = ActiveHaiBaoMid;
    }

    public String getActiveJieShao() {
        return StringUtils.dataFilter(ActiveJieShao);
    }

    public void setActiveJieShao(String ActiveJieShao) {
        this.ActiveJieShao = ActiveJieShao;
    }


    public List<BaomingPeoplesData> getCanyuPeoples() {
        return CanyuPeoples;
    }


    public String getNiChenName() {
        return NiChenName;
    }

    public void setNiChenName(String NiChenName) {
        this.NiChenName = NiChenName;
    }

    public int getCanyuPeopleCount() {
        return CanyuPeopleCount;
    }

    public void setCanyuPeopleCount(int CanyuPeopleCount) {
        this.CanyuPeopleCount = CanyuPeopleCount;
    }


    public String getTime() {
        StringBuilder sb = new StringBuilder();
        sb.append("报名开始 : ");
        sb.append(DateUtils.dateToString(getStartTime(), "yyyy-MM-dd HH:mm"));
        sb.append("\n报名截止 : ");
        sb.append(DateUtils.dateToString(getEndTime(), "yyyy-MM-dd HH:mm"));

        return sb.toString();
    }

    public long getActivedjs() {

        long difference = SystemClock.elapsedRealtime() - elapsedRealtime;
        return Activedjs - difference;
    }

    public void setActivedjs(int Activedjs) {
        elapsedRealtime = SystemClock.elapsedRealtime();
        this.Activedjs = Activedjs;
    }


    public HuoDongStatus getHuoDongStatus() {
        if (differenceTime <= 0) {
            differenceTime = DateUtils.dateToLong(EndTime) - DateUtils.dateToLong(StartTime);
        }
        long djs = getActivedjs();
        if (djs > 0) {//倒计时大于0  代表活动没开始
            return HuoDongStatus.NO_START;
        } else if (Math.abs(djs) < differenceTime) {//倒计时绝对值 小于 开始时间与结束时间的差值    就是进行中
            return HuoDongStatus.ACTIONING;
        } else {//其他情况就是已经结束
            return HuoDongStatus.STOP;
        }


    }
}
